package com.songcha.module_home.ui.decoration

import android.graphics.Rect
import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.songcha.library_common.util.dp2px

class HomeHomeNewBookShelveItemDecoration:RecyclerView.ItemDecoration() {
    override fun getItemOffsets(
        outRect: Rect,
        view: View,
        parent: RecyclerView,
        state: RecyclerView.State
    ) {
       // val layoutParams: GridLayoutManager.LayoutParams =
          //  view.layoutParams as GridLayoutManager.LayoutParams

        /*if(layoutParams.spanIndex%2==0){
            outRect.left=8.dp2px()
            if(layoutParams.absoluteAdapterPosition>1){
                outRect.top=14f.dp2px().toInt()
            }else{
                outRect.top=0f.dp2px().toInt()
            }
            outRect.right=0f.dp2px().toInt()
            outRect.bottom=0f.dp2px().toInt()
        }else if(layoutParams.spanIndex%2==1){
            outRect.left=0.dp2px()
            outRect.top=0f.dp2px().toInt()
            if(layoutParams.absoluteAdapterPosition>1){
                outRect.top=14f.dp2px().toInt()
            }else{
                outRect.top=0f.dp2px().toInt()
            }
            outRect.right=8f.dp2px().toInt()
            outRect.bottom=0f.dp2px().toInt()
        }*/

    }
}